package com.moyq5.permit.center.bean.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;

import com.moyq5.permit.center.bean.enums.SysPlatform;

/**
 * 角色
 * @author Moyq5
 * @date 2018年4月13日
 */
@Entity
@Table(name = "sys_role")
@DynamicUpdate
public class SysRole implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * 角色ID
	 */
	@Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "native")@GenericGenerator(name = "native", strategy = "native")
    @Column(name = "role_id")
	private Long roleId;
	/**
	 * 角色名称
	 */
	@Column(name = "name", length = 60, nullable = false)
	private String name;
	/**
	 * 角色编码（至少同一平台类型唯一）
	 */
	@Column(name = "code", length = 60, nullable = false)
	private String code;
	/**
	 * 平台类型
	 */
    @Enumerated(EnumType.ORDINAL)
    @Column(name = "platform", precision = 2)
	private SysPlatform platform;
    /**
     * 权限，多个权限id用,号隔开
     */
    @Column(name = "permits", length = 1000)
    private String permits;
	public Long getRoleId() {
		return roleId;
	}
	public void setRoleId(Long roleId) {
		this.roleId = roleId;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public SysPlatform getPlatform() {
		return platform;
	}
	public void setPlatform(SysPlatform platform) {
		this.platform = platform;
	}
	public String getPermits() {
		return permits;
	}
	public void setPermits(String permits) {
		this.permits = permits;
	}
	@Override
	public String toString() {
		return "SysRole [roleId=" + roleId + ", name=" + name + ", code=" + code + ", platform=" + platform
				+ ", permits=" + permits + "]";
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
}
